Part Number Hot Search : 
WSD751B 15001HS N4728 128J3 MAX6724 LBS17801 2SC0829 20N03L
Product Description
Full Text Search
 

To Download AN721 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  rev. 1.2 10/13 copyright ? 2013 by silicon laboratories AN721 AN721 cp21 xx d evice c ustomization g uide relevant devices ? this application note applies to the following devices: ? cp2101, cp2102, cp2103, cp2104, cp2105, cp2108, cp2110, cp2112, cp2114, cp2130 1. introduction this document explains the steps required to customize a fixed function usb device. it is intended for developers creating products based on the cp210x/cp211x/cp2130 u sb bridge controllers. it contains information about obtaining a vendor id (vid) and product id (pid) for a cp210x/cp211x/cp2130 product and describes the steps necessary for cu stomizing the device de scriptors. refer to www.silabs.com/interface for the latest revisions of this document and other appl ication notes related to the cp21 0x/cp211x/cp2130 device families. 1.1. usb logos and ce rtification testing usb is a widely used peripheral. the usb implementers forum, inc. has introduced trademark-protected logos for use with qualified usb products. to use the logo, usb pr oducts are required to meet the standards of the usb implementers forum. for a product to have compliance and/or certification implies that the usb product has been tested by the usb-if to meet the specif ication. each type of usb product requ ires specific testing to be listed on the integrators list. this is important not only to oems but to consumers because products tested and certified by the usb-if are assured to work together. compliance test ing exists to help manufacturers measure how well their products match the respective usb sp ecification. if a product has passed u sb-if compliance test ing, the company can use the usb logo on the products. 1.2. usb vendor ids and product ids each device on a usb bus must have a unique vendor id (v id), product id (pid), and serial number combination. this id system uniquely identifies the different devices on the bus to avoid conflicts. the pc uses the vid/pid to find the drivers (if any) to be used for the usb device. the vid/pid must be unique in that each usb device with the same vid/pid will use the same driver , and it is strongly recommended to make the pid unique to a particular design. the usb devices of a given vid/pid combination c an be serialized, which allows the operating system to track not only a particular model, but also a specific board of that model. vendor ids are owned by the vendor company and assigned by the usb implementers forum (usb-if) only. details about obtaining a unique vid can be found at www.usb.org/developers/vendor . to obtain the right to licen se the usb-if logo, register the product' s vid and pid with usb-if and submit the product to the usb-if compliance program. usb-if compliance program details are available at ? www.usb.org/developers/compliance . once the product is certified, it can be added to the usb-if integrators list, and the ?certified usb? logo can be us ed on the product. the defau lt silicon labs vid is 0x10c4 and the default silicon labs pid is dependent on t he device. to obtain a unique pid fo r your cp210x/cp211x/cp2130-based product, visit ? http://www.silabs.com/requestpid . note that customization of the usb strings is optional, but is strongly recommended. a unique vi d/pid combination will prevent the driver from conflictin g with any other usb driver.
AN721 2 rev. 1.2 2. basic device customization the steps to customize the cp210x family of devices is slightly different than customizing the cp211x and cp2130 devices. the cp210x devices require a driver, but the cp21 1x devices do not because they are of the hid class, which is natively supported by most operating systems. the next two se ctions describe the recommended steps for customizing the device based on the family , either the cp210x, cp211x, or cp2130. 2.1. summary of steps for custom izing the cp210x non-hid usb devices the cp210x family of devices provides communication from usb to uart. this requires a driver to interface to the device. there are two types of drivers provided. one is the virtual com port (vcp) driver which allows the device to appear to the pc?s application software as a com port. th is driver is always used first to connect to the device customization software program to chan ge the pid since by default this driver has the same vid and pid as what is programmed in the default devices. after the device cust omization software program is used to change the pid, the driver must match the new values that have been loaded in the device from the device customization software. if the user wants to communicate to the device via a high level applicatio n program, a usbxpress driver can be used which provides this function ality. this driver must be downloaded and installed after using the device customization software. then the usbx press driver or vcp driver (whi ch ever one will be used) should be updated to make sure the driver matches the vid and pid in the device. a pc cannot have both the vcp and usbxpress drivers loaded with th e same vid and pid, as this would cause usb device id entification conflicts. in the end, only one driver can be used, either th e vcp or the usbxpress. there are vcp and usbxp ress drivers for various o perating systems, which are a ll listed on the website at ? http://www.silabs.com/products/mcu/pa ges/usbtouartbridgevcpdrivers.aspx for the vcp driver and at www.silabs.com/usbxpress for the usbxpress driver. the process described below must be followed each time a new operating system must be supported. if the driver has been certified for windows 7 32-bit and then it is necessary to support windows 7 64-bit, then the driver must be recertified. the microsoft certification process must be initiated again, and the reseller fee must be paid to microsoft for the 64-bit version of the driver. microsoft requires this certification pr ocess which involves windows hardware qua lity labs testing (whq l). it certifies that the hardware or software has been tested by microsoft to ensure compatibility. device driv ers that pass the whql tests are given a digitally signed certification file, which prevents windows from displaying a warning message that the driver has not been certified by microsoft. figure 1 shows the default vid and pid values for the device and drivers. to establish communication with the driver, the vid and pid of the device must match the driv er. notice that the default cp210x device vid and pid match the default vcp driver vid and pid numbers.
AN721 rev. 1.2 3 figure 1. default vid and pid values for driver vs firmware the steps to customize the cp210x usb devices are as follows: 1. request a unique pid from silicon labs for your ne w product design: http://www.silabs.com/requestpid , or obtain a vid/pid from usb.org. 2. download the vcp driver appropriate for your operating system here: ? http://www.silabs.com/products/mcu/pages/usbtouartbridgevcpdrivers.aspx . the stock vcp driver from the website should match the default vid and pid in the cp210x. the vcp driver must be installed with matching vid and pid to communicate to the device. 3. run the device customization so ftware program described in the next sections to change the descriptors in the device. 4. (usbxpress users only): if the desired driver is usbxp ress, it can be download here: ? www.silabs.com/usbxpress . this driver allows dire ct access using silicon labs api commands to control the device. when this driver is initially downloaded it will no t have the matching vi d/pid of the cp210x devices. see figure 1 for the default driver and device vid/pid. 5. use the usb driver customiz ation wizard and instructions in an220sw and an220 ?usb driver customization? https://www.silabs.com/support%20documents/technicaldocs/an220.pdf to update the driver for the new pid and any other descriptors that ha ve been changed from step 3. be certain to use the version of an220 software which corresponds to the correct driver when generating the modified drivers. take care to verify that these customized drivers are completely correct, as none of the files in the driver package can change in any way once the driver has been certified. if you do not have the correct version of the an220 software, please contact our support team www.silabs.com/contactsupport . update either the vcp driver (com port) or usbxpress driver (api commands) to match the device. the usb driver customization wizard customizes the dr iver by changing the hardware insta llation files (.inf) in the driver package. the strings contained in the .inf files af fect what is displayed in the ?found new hardware wizard? dialogs, device ma nager and the registry. any changes to the windows? installation .inf files will require new windows hardware quality labs (whql) tests. stock vcp driver cp2101-cp2104: vid: 0x10c4 pid: 0xea6 0 cp2105: vid: 0x10c4 pid: 0xea7 0 cp2108: vid: 0x10c4 pid: 0xea7 1 default firmware in device cp2101-cp2104: vid: 0x10c4 pid: 0xea60 cp2105: vid: 0x10c4 pid: 0xea70 cp2108: vid: 0x10c4 pid: 0xea71 stock usbxpress driver cp2101-cp2104: vid: 0x10c4 pid: 0xea6 1
AN721 4 rev. 1.2 6. (microsoft windows only): the customized driver is e ligible for whql re-seller submissions to certify the driver. these submissions do not have the high cost and testing requirements of an original driver submission. to certify a customized vcp or us bxpress driver, register at the winqual site ? https://sysdev.microsoft.com to obtain a winqual account with your company. internet explorer is the only web browser that can be used with the whql website. a verisign id is needed to register an account (instructions for obtaining one are available at microsoft's website: ? http://msdn.microsoft.com/en-us/library/windows/hardware/hh801887?ppud=4 . the correct verisign id is the codesigner standard ? http://www.verisign.com/code-signing/microsoft-authenticode/index.html?sl=header. 7. (microsoft windows only): after obtaining a winqual account, not ify the silicon labs support team www.silabs.com/contactsupport to be added as a registered reseller. provide the driver type (vcp or usbxpress) and version (e.g., v6.5 ) when requesting reseller status. 8. (microsoft windows only ) : silicon labs will add your company as a registered reseller. your company must complete the provided directions to finish the recertification process. note: for further detailed instructions on microsoft?s submission proce ss for recertification for a customized driver please view the document attached to the knowledgebase article called ?how to recertify a customized driver package.pdf? located here: http://cp-siliconlabs.kb.net/ar ticle.aspx?article=89180&p=4120. 2.2. summary of steps for customiz ing the cp211x hid usb devices the cp211x family does not require a dr iver because it is automatically recogn ized as part of the hid class, which simplifies the process. most operating systems include native driver s. the cp211x will not fit a standard hid device type such as a keyboard or mouse. any cp211x pc application will n eed to use the specific cp211x hid specification to communicate with it. th is low-level hid specificat ion is documented and pr ovided by silicon labs in the form of a dll. the following are the steps to follow to customize the cp211x hid usb devices to ensure a unique vid/pid combination: 1. request a unique pid from silicon labs for a new design: http://www.silabs.com/requestpid. 2. use the device customization soft ware program described in section 3 below to change the descriptors in the firmware of the device. 2.3. summary of steps for cu stomizing cp2130 us b-to-spi devices the cp2130 family of devices provides communication from usb to spi. this requires a driver to interface to the device. in most cases, a generic usb driver, such a mi crosoft's winusb or the open source libusb driver, can be used with the cp2130. all that is required is to generate a proper driver inf file that associates a cp2130 with a specific usb vid/pid with t he generic usb driver. the cp2130 evaluation kit ships with a winusb driver and inf file that includes support for the defau lt cp2130 vid/pid. in order to custom ize the cp2130, the user must install this stock driver in order for the cp21xx customization software to co mmunicate with the device. once the cp2130 has been customized and the vid and/or pid have changed, the user must customize the driver to recognize the new vid/pid. the cp2130 data sheet lists winusb drivers for variou s windows operating systems. the steps described below must be followed each time a new operating system is to be supported. if the driver has been certified for windows 7 32-bit and it becomes necessary to support windows 7 64-b it, then the driver must be recertified. the microsoft certification process must be in itiated again, and the reseller fee must be paid to microsoft for the 64-bit version of the driver. microsoft requires this certification proces s, which involves windows ha rdware quality labs testing (whql). it certifies that th e hardware or software has been tested by microsoft to ensure compatibility. device drivers that pass the whql tests are given a digitally-s igned certification file, which prevents windows from displaying a warning message that the driver has not been certified by microsoft. figure 2 shows the default vid and pid values for the devi ce and drivers. to establish communication with the driver, the vid and pid of the device must match the driv er. notice that the default cp2130 device vid and pid match the default winusb driver vid and pid numbers.
AN721 rev. 1.2 5 figure 2. default vid and pid values for driver vs. firmware perform the following steps to customize the cp2130 usb devices: 1. request a unique pid from silicon labs for your ne w product design: ? http://www.silabs.com/requestpid , or obtain a vid/pid from usb.org 2. download the winusb driver appropriate for your operating system from here: ? http://www.silabs.com/cp2130ek ? the stock winusb driver from the web site should match the default vid and pid in the cp2130. the driver must be installed with matching vid and pid to communicate to the device. 3. run the device customization software program described in the following sections to change the descriptors in the device. 4. modify a copy of the stock winusb driver hardware installation file (.inf) for the new pid and any other descriptors that have been changed from step 3. take care to verify that these customized drivers are completely correct, as none of the files in the driv er package can change in any way once the driver has been certified. the strings contained in the .inf file affect what is displayed in the ?found new hardware wizard? dialogs, device manager, and th e registry. any changes to the windows ? installation .inf files will require new windows hardware quality labs (whql) tests. 5. (microsoft windows only): the customized driver is eligible for whql re-seller submissions to certify the driver. these submissions do not have the high cost and testing requirements of an original driver submission. to certify a customized winusb driver, register at the winqual site: ? ( https://sysdev.microsoft.com ) to obtain a winqual account with your company. internet explorer is the only web browser that can be used with the whql web site . a verisign id is needed to register an account (instructions for obtaining one are available at the microsoft web site: ? http://msdn.microsoft.com/en-us/library/windows/hardware/hh801887?ppud=4 ? the correct verisign id is the codesigner standard: ? http://www.verisign.com/code-signing/microsoft-authenticode/index.html?sl=header. 6. (microsoft windows only): afte r obtaining a winqual account, noti fy the silicon labs support team ( www.silabs.com/contactsupport ) (click on ?open a support request?) to be added as a registered reseller. provide the driver type (cp2130 winusb) and vers ion (e.g., 1.0) when requesting reseller status. 7. (microsoft windows only): silicon labs will add your company as a regi stered reseller. your company must complete the provided directions to finish the recertification process. note: for further detailed instructions on microsoft?s submission proc ess for recertification for a customized driver, please view the document attached to the knowled gebase article called ?how to recertify a customized driver package.pdf? at: http://cp-siliconlabs.kb.net/ar ticle.aspx?article=89180&p=4120 . stock winusb driver cp2130: vid: 0x10c4 pid: 0x87a0 default firmware in device cp2130: vid: 0x10c4 pid: 0x87a0
AN721 6 rev. 1.2 3. device customization software the descriptors and other configurable options of th e devices in the cp210x/c p211x/cp2130 families are modifiable using the windows program cp21xx device customization software.exe ( figure 3 ). the software program automatically recognizes the de vice that is plugged into the pc. when the cp21xxcustomizationutility. exe is launched, the pr ogram searches the wind ows registry for any cp21xx devices attached to the pc. the full path information for all of the devices found is inserted into the ?select device? drop-down list, and the first de vice is selected automatically. this cp21xxcustomizationutility.exe program is included in the software zip file in this application note. the descriptions of how to use the program is described in more detail in the followin g sections for the different families of devices. be aware that one-time programmable (otp) devices can only be changed once . the program can ac cess the fields but will not be able to program them more than once. the cp21xx device customization software uses the wi ndows host api functions implemented by all the dll files for the different families of de vices mentioned. the host api functi ons give read/write access to the descriptors contained in programmable areas of a conn ected device. another option is implementing a custom application using the host api with the dll suited to the individual needs of a particular production environment. the descriptors can also be set in the factory at production time for large orders. contact your silicon laboratories sales representative for details. figure 3. device customization software general overview edit values here drop down list of connected devices click here to save values into flash set ids options baud rate alias options port i/o options log to a file status logging status logging status logging
AN721 rev. 1.2 7 the above program is an example of the cp2110 device, but the program is similar for all devices. there are three main sections that can be edited. the first one is the set ids section as shown. below th at is the baud rate alias section and then below that is the port configuration setti ngs. changes can be made in each of these sections and saved by clicking on the ?program devi ce? button. this will save the values into flash or one- time programmable memory. if any of these three main sections are blank it is because there is no configuration for the baud rate alias or port configuration. all devices will have the setid configuratio n. the status loggi ng window updates and prints out all the transactions to veri fy the device has programmed correctly. 4. changing device settings for the cp2110, cp2114, and cp2130 the cp2110, cp2114, and cp2130 are all one-time programma ble devices. the various customizable fields of the cp2110/cp2114/cp2130 devices are only programmable one time using the program. be careful to change all settings under every tab before clicking the ?program device? button. figure 4. cp2110, cp2114, and cp2130 device customization software set ids window when the device customization soft ware is launched, the program searches for any cp2110/cp2114/cp2130 devices attached to the pc. the full pa th information for all of the devices found is inserted into the "device selection" drop-down list, and the first device is select ed automatically. there is a set ids window and a port configuration window for both these devices.
AN721 8 rev. 1.2 4.1. set ids tab cp2110, cp2114, and cp2130 devices figure 4 shows the following modifiable parameters for the cp2110/cp2114/cp2130: 1. vid ?the vendor id is a four hexadecimal digit number such as 10c4. 2. pid ?the product id is a four hexade cimal digit number such as eab0. 3. power ?this is a two hexadecimal digit number such as 10 with a maximum setting of 250. note this number corresponds to units of current in 2 ma increments. therefore a value of 10 corresponds to 32 ma. 4. power mode ?there are three different po wer mode options. click the fi eld to see the options. 00 corresponds to bus powered, 01 is self powered with voltage regulator disabled, 02 is self powered with voltage regulator enabled. 5. release version ?the release version is a numerical identifier of the device release version. each field is a decimal number value 0?99. the first two digits are the major version number and the last two are the minor digits. 0100 corresponds to major version 01, minor version 00. figure 5. cp2110/cp2114 flush buffers options 6. flush buffers (cp2110/cp2114 only) ?the flush buffers options shown above in figure 5 allows open and close options on the rx and tx. check the options required for the application. 7. manufacturer ?this is the name of the company manufacturing the product. 8. product description ?the product description can be any sequenc e of up to 126 characters. usually this is text which provides a description of the device, such as cp2103 usb to uart bridge controller. 9. serial number ?the serial number can be any sequence of up to 63 characters. 10. transfer priority (cp2130 only) ?the cp2130 supports double-buffered usb out transfers in high-priority write mode or double-buffered usb in transfers in high-priority read mode.
AN721 rev. 1.2 9 4.2. port configuration sett ings cp2110, cp2114, and cp2130 the port configuration settings are available by clicking on the ?port conf iguration? tab. click on the number in the value box to access a drop down menu of options for each pin configuration. refer to the data sheet for further explanation of the different options available. after a va lue has been changed it will be highlighted in yellow. click the program device button when complete. the gpio pin settings in the cp2110/cp2114/cp2130 can be mo dified to set the pins for input, output push-pull, or output open drain. figures 6 , 7 , and 8 show the port configurations for the cp2110, cp2114, and cp2130, respectively. the alternate pin options are different and th e default values are different. the gpio pin configuration options and alternative functions are selectable from the drop down menu when clicking on the value. figure 6. cp2110 port configuration settings
AN721 10 rev. 1.2 figure 7. cp2114 port configuration settings
AN721 rev. 1.2 11 figure 8. cp2130 port configuration settings the suspend value setting allows the option for the latch to be enabled on any of the selected pins shown in figure 9 . a similar menu is available for the suspend mode allowing a selection between open-drain and push-pull for the different pins in suspend mode.
AN721 12 rev. 1.2 figure 9. cp2110/cp2114/cp2130 suspend value settings see ?an434: cp2110/4 interface specification? and ?an792: cp2130 interface specification? for a full description of each of the customizable parameters. if using the device customizat ion software to program multiple devices, the customized values can be saved to a text file using the file ? save and file ? save as commands. when connecting a new device, use the file ? open command to retrieve the save d settings, which are then directly programmable to the new device. notes: 1. avoid connecting more than one device containing the same vid, pid, and serial number combination. 2. clk must be configured as a ?clk output -push pull ? before configuring the ?clk output divider? setting. ? the manufacturer string, product string, and serial number are automatically converted to unicode strings before programming.
AN721 rev. 1.2 13 4.3. dac configuration application (cp2114 only) the dac configuration utility is access ed by clicking on the ?advanced? ta b and selecting ?dac configuration cp2114? shown in figure 10 . this is an application that allows audio co nfiguration strings to be sent to the one- time programmable memory or ram. the audio string is used by the cp2114 to configure the dac/codec. figure 10. advanced settings dac utility
AN721 14 rev. 1.2 figure 11 shows a screen shot of the dac utility. section 4.4 details all the configurat ion settings for the utility. figure 11. dac configuration
AN721 rev. 1.2 15 4.4. application command descriptions 4.4.1. get cp2114 capabilities this button will report the cu rrent configuration of the one-time programma ble memory. with the default pin configuration and no jumpers installed on gpio.5, gpio.6 , gpio.7, or gpio.8, the ut ility will display the following: * cp2114 caps availablebootindices: 0x20 availableotpconfigs: 0x1d currentbootconfig: 0xff availableotpconfigspace: 0x1532 the availablebootindices: 0x20 parameter indicates that all 32 boot index slots are available for programming. the availableotpconfigs: 0x1d parameter indicates that there are 29 cp2114 configurations available in the one-time programmable memory. the cp2114 evb ships with three default config urations in otp at the following indices: index 0: audio out and audio in streams both set to asynchronous with cs42l55 dac settings. index 1: audio out and audio in streams both set to asynchronous with wm8523 dac settings. index 2: audio out and audio in streams both se t to asynchronous with pcm1774 dac settings. the currentbootconfig parameter with a value of 0x ff indicates the cp2114 will no t configure any dac devices on a reset or boot.this occurs when ?? dac select input feature is turned on and no ju mpers are installed on gpio .5, gpio.6, gpio.7, and gpio.8. ?? dac select input feature is turned on and the gpio va lue is set to ?use otp bo ot config? while no valid boot config entry is found in the one-time programmable memory. ?? dac select input feature is turned off and there is no valid boot config entry in the one-time programmable memory. the cp2114 has 32 programmable boot configuration entrie s by default. (the cp2114 boot configuration can be changed up to a total of 32 times.) the final parameter, availableotpconfigspace: 0x1532 indicates there are 0x1532 (5426) bytes of programmable memory available to support new configurations. 4.4.2. reset device this button forces a cp2114 reset. 4.4.3. load config text from file loads configuration text from a file into the config text window. 4.4.4. save config text to file saves the text in the config text window to a file. 4.4.5. write config text to ram writes the configuration displayed in the config text window into the cp2114 ram. the dac configurations are also written to the dac. this operation will cause the cp21 14 to disconnect and reconn ect on the usb bus. this configuration is not retained on device reset. 4.4.6. write config text to otp writes the configuration in the config text window to the one-time programmabl e memory. the configuration does not become the active configuration in ram unless it?s spec ified in cp2114 boot config or via dac select gpio pins followed by power cycling or resetting the device. 4.4.7. read cp2114 config from otp after specifying the configurat ion number in the text box to the right of the button and clicking the button, the utility will display the one-time progr ammable memory configuratio n in the output window.
AN721 16 rev. 1.2 4.4.8. set cp2114 boot config after specifying the configuration number in the text box to the right of the button and clicking the button, the boot configuration index is programmed into the one-time programmable memory space. note: the cp2114 boot configuration index can be changed up to 32 times. 4.4.9. get dac registers displays one or more dac registers in the output window. to display a contiguous range of dac registers enter the starting register address in the start address field and the number of registers to read in the num registers field. click get dac registers and the register values will be displayed in the status wi ndow as hex comma-separated values. 4.4.10. save final device customization to file save the final 5.5 kb of customized data into a file for one-time programming in production. 4.5. using the cp2114 dac application use the following steps to program the cp2114 using th e dac configuration utility: 1. click get cp2114 capabilities and note the boot index, available ot p boot index slots, and available otp config space. 2. click load config text from file if there is one available; otherwise write the config text into the config text window directly. 3. click write config text to ram . this will cause cp2114 to re-enumerate over usb. once cp2114 device is seen by the host again, verify the device's audi o functionalities including volume control and mute control. adjust the value in config text if necessary and repeat write config text to ram until desired result is achieved. 4. verify the dac registers have the desired setting by entering the s tart address and num registers and clicking get dac registers . 5. click save config text to file to save a copy of the text in the config text window. 6. click write config text to otp after all functionalities have been completely verified in ram. the new config will consume one boot config index slot and so me one-time prog rammable config sp ace. the index of this new config should be the ne xt available index. for example, if get cp2114 capabilities returned availableotpconfigs of 0x1d, th is configuration index will be 3. 7. enter the index of the new config and click read cp2114 config from otp . verify the data returned is as expected. 8. click get cp2114 capabilities and verify the available otp config space is (2+config data bytes) less than the previous value. the firmware inserts 2-byte length before the config da ta when writing to otp. available otp configs should be 1 less than the previous value. 9. enter the configuration index of the new config and click set cp2114 boot config to make cp2114 to boot from the new config. 10. reset the cp2114. 11. verify cp2114 boots up properly with dac function ing properly. verify volume and mute integration with the host. click save final device configuration to file for otp programming in production.
AN721 rev. 1.2 17 5. changing device settings cp210x there are six different cp210x devices. the cp2104 and cp 2105 are one time programmable (otp), therefore it is important to be careful when programming these sinc e they cannot be programmed multiple times. the cp2101- cp2104 are all usb to single uart devices. the cp210 5 is a usb to dual uart and the cp2108 is a usb to quad uart. 5.1. set ids cp210x devices all cp210x devices have strings that can be modified in the setids window. figure 12. cp210x set ids figure 12, ?cp210x set ids,? shows the modifiable parameters for all the cp210x devices. the cp2105 device shown on the left has 2 interface strings because it is a dual uart device. the cp2108 on the right has 4 interface strings because it is a quad uart device. there are 4 different interfaces. the single interface devices cp2101- cp2104 do not require an interface string since with only one interface there is only one option. the interface strings are unique to the cp2105 and cp2108 since they have multiple interfaces. all the devices contain the following parameters: 1. vid ?the vendor id is a four hexadecimal digit number such as 10c4. 2. pid ?the product id is a four hexadecimal digit number such as ea60. 3. power ?this is a two hexadecimal digit number such as 10 with a maximum setting of 250. note this number corresponds to units of current in 2 ma increments. therefore a value of 10 corresponds to 32 ma. 4. power mode ?there are three different po wer mode options. click the fi eld to see the options. 00 corresponds to bus powered, 01 is self powered with voltage regulator disabled, 02 is self powered with voltage regulator enabled. 5. release version ?the release version is a numerical identifier of the device release version. each field is a decimal number value 0?99. the first two digits are the major version number and the last two are the minor digits. 0100 corresponds to major version 01, minor version 00.
AN721 18 rev. 1.2 6. product description ?the product description can be any sequenc e of up to 126 characters. usually this is text which provides a description of the device, such as cp2103 usb to uart bridge controller. 7. interface string ?the string that identifies the different interface. this parameter is only present in the cp2105 and the cp2108, which have multiple interfaces. 8. serial number ?the serial number can be any sequence of up to 63 characters. 9. device mode ?the mode of the interface on the device, ei ther gpio or modem mo de. this parameter is only present on cp2105. 5.2. baud rate alias c onfiguration (cp2102, cp2103) the cp2102 and cp2103 have baud ra te alias configuration settings. ch anging the values in this table will cause the cp210x to translate 1 of 32 fixed uart baud rates to a desired baud rate shown in figure 13 . all ranges for a requested baud rate are shown. figure 13. baud rate configuration
AN721 rev. 1.2 19 baud rate aliasing refers to configuring a specific baud ra te range to target a baud rate that is different from the default baud rate. further support information can be found in the device data sheet for the cp2102/cp2103, which have this feature. the application-requested baud rate ranges are static and can never be changed. the actual uart baud rate corresponding to a particular baud rate range is fully customiz able. this customization is done using a windows dynamic link library (dll) named cp210xmanufacturing.d ll. using the functions available in this api (getbaudratec onfig() and setbaud rateconfig()) the eeprom se ttings can be changed using the usb connection. each line displays a range of baud rates that an application might request. there is a desired baud rate to use in that range and the actual baud rate that is used. to ch ange the current configuration click on the desired baud rate number and enter in a new value. the actual baud ra te field will update to show the closest baud rate the hardware can achieve. normally thes e two numbers will not be exactly the same , but as long as the actual baud rate is within 3% of the de sired baud rate, the communicat ion channel will work correctly. 5.3. port configuration (cp2103, cp2104, cp2105, cp2108) the cp2103, cp2104, cp2105 and cp2108 all have modifiable port settings. these port settings have three types of interface pins. the uart/modem interface pins cons ist for the signals ri, dcd, dtr,dsr,txd,rxd,rts and cts. these signals are used for uart communication an d the associated handshaking. the second type of interface pin is for general purpose input/output (gpio). th is type consists of all signals named gpio.x where x is a number. these signals are available for any user-defined fu nction. the final type of interface pin is for power control and consists of suspend and suspend signals. these signals are used to gate power consumption of external circuitry for bus-powered usb products. the following interface pin configuration options are available. 5.3.1. mode the mode setting controls whether the interface pin operates in push-pull or open-drain mode. this setting is not available on the rxd pin. see sections 5.3.8 and 5.3.9 for details concerning pin modes. 5.3.2. reset latch value this setting controls th e initial value of the interface pin latch, after a device reset. not available on rxd, txd, suspend, suspend , and gpio pins set for device-c ontrolled function. see section 5.3.11 for details concerning pin reset behavior. 5.3.3. weak pull-ups this setting enables a weak pull-up for all interface pins. this setting applies to the device as a whole and cannot be configured for each pin independently. upon reset, weak pull-ups are enabled. 5.3.4. gpio pin function by default, the gpio pins are controlled manually by host-based software using the cp210xruntime.dll and an open handle to the com port to read and write the latch. alternatively, the cp210x device can automatically control certain gpio pin latches for a predetermined function. when operating in this mode, the gpio pin will no longer be available using the cp210xruntime.dll . host writes will have no effect, and host reads will be logic high. this device -controlled func tion is available as shown in ta b l e 1 .
AN721 20 rev. 1.2 5.3.5. dynamic suspend by default the latch values for all interface pins remains static during usb suspend. alternatively, the dynamic suspend feat ure sets the interface pin latch to a predefined state when the cp210x device moves from the configured usb state to the susp end usb state (see chapter ni ne of usb 2.0 specification for more information on usb device states). when the devic e exits the suspend usb state the interface pin latch is restored to the previous value before entering the susp end state. dynamic suspend is configured separately for the gpio pins and uart/modem control pins. 5.3.6. latch value (suspend) when dynamic suspend is enabled, this value is written to the interface pin latch when the cp210x device moves from the configured usb state to the suspend usb stat e (see chapter nine of usb 2. 0 specification for more information on usb device states). not available on rxd, suspend, suspend , and gpio pins set for device- controlled function. 5.3.7. high-impedance input by configuring for open-drain operation and writing logi c high (1) to the latch, an interface pin assumes a high impedance state. this input pin will have electrical char acteristics as listed in table 3 of the device data sheet. 5.3.8. push-pull output by configuring for push-pull operation, an interface pin operates as a push-pull output. the output voltage is determined by pin?s latc h value. this output pin will have electrical characteristics as lis ted in table 3 of the device data sheet. this type of output is most ofte n used to connect directly to another device. 5.3.9. open-drain output by configuring for open-drain operation, an interface pi n operates as an open-drain output. the output voltage is determined by the pin's latch value. if the pin latch va lue is 1, the pin is pulled up to vdd (cp2102) or vio (cp2103, cp2104, cp2105) through an on-chip pull-up resistor. the pin can also be safely pulled up to 5 v if an external pull-up resistor is added. this output pin will have electrical characteristics as listed in table 3 of the device data sheet. 5.3.10. low power state by writing logic low to the latch, an interface pin is grounded and consumes minimal power with weak pull-ups disabled. this setting is best for unused interface pi ns that are not connected to external circuitry. 5.3.11. reset behavior all interface pins temporarily float high during a device reset. if this behavior is undesirable, a strong pull-down (10 k ? ) can be used to ensure the pin remains low during reset. figure 14 is a screenshot of the cp2103 and cp2104 port configuration settings. figure 15 is a screenshot of the cp2105 port configuration settings and figure 16 is a screenshot of the cp2108 port configuration settings. click on the value to modify any of the settings. in most case s a pull down menu is ava ilable. for the suspend value and the reset value settings a pop up window a llows the latch setting selections as shown in figure 17 . table 1. gpio pin function pin name function behavior gpio.0 transmit led toggles when there is uart data to transmit; otherwise logic high gpio.1 receive led toggles when there is data on the uart receive buffer; otherwise logic high. gpio.2 rs-485 logic low while transmitting uart data; otherwise logic high. note: on the cp2105, rs-485 mode is avai lable on the enhanced communication inte rface (eci) on gpio.1. because of this, the alternate function gpio.1_eci can either be receive led or rs-485 mode. the standard communication interface (sci) does not have an rs-485 mode.
AN721 rev. 1.2 21 figure 14. cp2103/cp2104 port configuration
AN721 22 rev. 1.2 figure 15. cp2105 port configuration
AN721 rev. 1.2 23 figure 16. cp2108 port configuration
AN721 24 rev. 1.2 figure 17. latch settings
AN721 rev. 1.2 25 6. cp210x host api functions there are two dll files cp210xmanufacturing.dll and cp210xruntime.dll which have several api functions that are described and listed. 6.1. cp210xmanufacturing.dll the cp210x host api is pr ovided as a means to facilitate producti on of customized cp210 x devices. the api allows access to the cp210x device for retrieving and se tting the vid, pid, product string, serial number, self- power attribute, maximum power consumption, and device version. the cp210x host api is provided in the form of a windows dynamic link library (dll), cp210xmanufacturing.dll . the host interface dll communicates with the bridge controller device via the provided device driver and the operating system's usb st ack. the following is a list of the available host api functions: cp210x_getnumdevices() returns the number of cp210x devices connected. cp210x_getproductstring() returns a descriptor from the registry for a cp210x usb device. cp210x_getpartnumber() returns the 1-byte part number of a cp210x device. cp210x_open() opens a cp210x device as a usb device and returns a handle. cp210x_close() closes a cp210x device handle. cp210x_setvid() sets the 2-byte vendor id of a cp210x device. cp210x_setpid() sets the 2-byte product id of a cp210x device. cp210x_setproductstring() sets the product description string of a cp210x device. cp210x_setinterfacestring() sets the interface string of a cp2105 device. cp210x_setserialnumber() sets the serial number st ring of a cp210x device. cp210x_setselfpower() sets the self-power attribute of a cp210x device. cp210x_setmaxpower() sets the maximum power consumption of a cp210x device. cp210x_setflushbufferconfig() sets the flush buffer configuration of cp2104/5 devices. cp210x_setdevicemode() sets the operating modes of both interfaces of a cp2105 device. cp210x_setdeviceversion() sets version number of the cp210x device. cp210x_setbaudrateconfig() sets the baud rate configuration data of a cp210x device. cp210x_setlockvalue() sets the 1-byte lock value of a cp210x device. cp210x_setportconfig() sets the port configuration of a cp2101/2/3/4 device. cp210x_setdualportconfig() sets the port configuration of a cp2105 device. cp210x_setquadportconfig() sets the port configuration of a cp2108 device. cp210x_getdeviceproductstring() gets the product description string of a cp210x device. cp210x_getdeviceinterfacestring() gets the interface string of a cp2105 device. cp210x_getdeviceserialnumber() gets the serial number string of a cp210x device. cp210x_getdevicevid() gets the vendor id of a cp210x device. cp210x_getdevicepid() gets the product id of a cp210x device. cp210x_getselfpower() gets the self-power attribute of a cp210x device. cp210x_getmaxpower() gets the maximum power consumption value of a cp210x device. cp210x_getflushbufferconfig() gets the flush buffer configuration of cp2104/5 devices. cp210x_getdevicemode() gets the operating modes of interfaces of a cp2105 device. cp210x_getdeviceversion() gets the version number of a cp210x device. cp210x_getbaudrateconfig() gets the baud rate configuration data of a cp210x device. cp210x_getlockvalue() gets the 1-byte lock value of a cp210x device. cp210x_getportconfig() gets the port configur ation of a cp210x device. cp210x_getdualportconfig() gets the port configuration of a cp2105 device. cp210x_getquadportconfig() gets the port configuration of a cp2108 device. cp210x_reset() resets a cp210x device.
AN721 26 rev. 1.2 in general, the user initiates communication with the target cp210x device by making a call to cp210x_getnumdevices() . this call returns the number of cp210x target devices. this number is used as a range when calling cp210x_getproductstring() to build a list of devices connected to the host machine. a handle to the device must first be opened by a call to cp210x_open() using an index determined from the call to cp210x_getnumdevices() . the handle will be used for all subseque nt accesses. when i/o operations are complete, the device handle is closed by a call to cp210x_close() . when programming a cp2105 device to configure the mode, the following functions must be called in the following order: cp210x_setdevicemode() cp210x_setdualportconfig() the remaining functions are provided to allow access to customizable values contained in the cp210x programmable area. 6.1.1. cp210x_getnumdevices description: this function returns the number of cp210x devices connected to the host. supported devices: cp2101, cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_getnumdevices( lpdword numdevices ) parameters: 1. numdevices?address of a dword that will contain th e number of devices. return value: cp210x_status = cp210x_success, ? cp210x_device_not_found, ? cp210x_invalid_parameter 6.1.2. cp210x_getproductstring description: this function returns a null-termi nated serial number (s/n) string, product description string, or full path string for the device specified by an in dex passed in the devicenum parameter. the index of the first device is 0, and th e index of the last device is th e value (numdevices) returned by cp210x_getnumdevices() ? 1. supported devices: cp2101, cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_getproductstring( dword devicenum, ? lpvoid devicestring, dword options ) parameters: 1. devicenum?index of the device for which the product descripti on string, serial number, or full path is desired. 2. devicestring?variable of type cp210x_device_string returning the null-terminated serial number, device description or full path string. 3. options?flag that determines if devicestring contains the product description, serial number, or full-path string. return value: cp210x_status = cp210x_success, ? cp210x_device_not_found, ? cp210x_invalid_parameter
AN721 rev. 1.2 27 6.1.3. cp210x_getpartnumber description: returns the 1-byte part number contained in a cp210x device. supported devices: cp2101, cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status winapi cp210x_getpartnumber(handle cyhandle, ? lpbyte lpbpartnum); parameters: 1. handle?handle to the device returning a part number. 2. partnum?pointer to a 1-byte value returning the part number of the device. ? a cp210x_cp2101_device denotes a cp2101 device, and a cp210x_cp2102_device denotes a cp2102 device. return value: cp210x_status = cp210x_success, ? cp210x_invalid_parameter, ? cp210x_invalid_handle, ? cp210x_device_io_failed 6.1.4. cp210x_open description: opens and returns a handle to a device using a device number determined by the number returned from cp210x_getnumdevices() . supported devices: cp2101, cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_open( dword devicenum, handle* handle ) parameters: 1. devicenum?device index. 0 for the first device, 1 for the second, etc. 2. handle?pointer to a variable where the handle to the device will be stored. this handle will be used for all subsequent accesses to the device. return value: cp210x_status = cp210x_success, ? cp210x_device_not_found, ? cp210x_invalid_parameter 6.1.5. cp210x_close description: closes an open device handle. supported devices: cp2101, cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_close( handle handle ) parameters: 1. handle?handle to the device to close as returned by cp210x_open() . return value: cp210x_status = cp210x_success, ? cp210x_invalid_handle
AN721 28 rev. 1.2 6.1.6. cp210x_setvid description: sets the 2-byte vendor id field of th e device descriptor of a cp210x device. supported devices: cp2101, cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_setvid( handle handle, word vid ) parameters: 1. handle?handle to the device to close as returned by cp210x_open() . 2. vid?2-byte vendor id value. return value: cp210x_status = cp210x_success, ? cp210x_invalid_handle, ? cp210x_device_io_failed 6.1.7. cp210x_setpid description: sets the 2-byte product id field of th e device descriptor of a cp210x device. supported devices: cp2101, cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_setpid( handle handle, word pid ) parameters: 1. handle?handle to the device to close as returned by cp210x_open() . 2. pid?2-byte product id value. return value: cp210x_status = cp210x_success, ? cp210x_invalid_handle, ? cp210x_device_io_failed 6.1.8. cp210x_setproductstring description: sets the product description string of the string de scriptor of a cp210x devic e. if the string is not already in unicode format, the function will convert t he string to unicode befo re committing it to programmable memory. the character size limit (i n characters, not bytes), not including a null terminator, is cp210x_max_product_strlen or cp2105_max_product_strlen . supported devices: cp2101, cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_setproductstring( handle handle, lpvoid product, ? byte length, bool converttounicode=true ) parameters: 1. handle?handle to the device to close as returned by cp210x_open() . 2. product?buffer containing the product string value. 3. length?length of the string in characters (n ot bytes), not including a null terminator. 4. converttounicode?boolean flag that tells the function if the string needs to be converted to unicode. the flag is set to true by default (i.e ., the string is in ascii format and needs to be converted to unicode).
AN721 rev. 1.2 29 return value: cp210x_status = cp210x_success, ? cp210x_invalid_parameter, ? cp210x_invalid_handle, ? cp210x_device_io_failed 6.1.9. cp210x_setinterfacestring description: sets the interface string for the one of the inte rfaces available on the cp2105 or cp2108. if the string is not already in unico de format, the function will convert the string to unic ode before com - mitting it to programmable memory. the character size limit (in characters, not bytes), not includ - ing a null terminator, is cp2105_max_interface_strlen . supported devices: cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_setinterfacestring( handle handle, byte interfa- cenumber, lpvoid interface, byte length, bool converttounicode) parameters: 1. handle?handle to the device to close as returned by cp210x_open() . 2. interfacenumber?set to 0 for enhanced interface string, or 1 for standard interface string on the cp2105. 0-3 for the cp2108 which has 4 interfaces. 3. interface?buffer containing the interface string. 4. length?length of the string in characters (n ot bytes), not including a null terminator. 5. converttounicode?boolean flag that tells the function if the string needs to be converted to unicode. the flag is set to true by default (i.e ., the string is in ascii format and needs to be converted to unicode). return value: cp210x_status = cp210x_success, ? cp210x_invalid_parameter, ? cp210x_invalid_handle, ? cp210x_device_io_failed 6.1.10. cp210x_setserialnumber description: sets the serial number string of the string descri ptor of a cp210x device . if the string is not already in unicode format, the function will convert t he string to unicode befo re committing it to programmable memory. the character size limit (i n characters, not bytes), not including a null terminator, is cp210x_max_serial_strlen . supported devices: cp2101, cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_setserialnumber( handle handle, ? lpvoid serialnumber, byte length, bool converttounicode=true ) parameters: 1. handle?handle to the device to close as returned by cp210x_open() . 2. serialnumber?buffer containing the serial number string value. 3. length?length in characters (not bytes), not including a null terminator. 4. converttounicode?boolean flag that tells the function if the string needs to be converted to unicode. the flag is set to true by default, i.e. the string is in ascii format and needs to be converted to unicode.
AN721 30 rev. 1.2 return value: cp210x_status = cp210x_success, ? cp210x_invalid_parameter, ? cp210x_invalid_handle, ? cp210x_device_io_failed 6.1.11. cp210x_setselfpower description: sets or clears the self-powered bit of the power a ttributes field of the configuration descriptor of a cp210x device. supported devices: cp2101, cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_setselfpower( handle handle, bool selfpower ) parameters: 1. handle?handle to the device to close as returned by cp210x_open() . 2. selfpower?boolean flag where true means set the self-powered bit, and false means clear the self-powered bit. return value: cp210x_status = cp210x_success, ? cp210x_invalid_handle, ? cp210x_device_io_failed 6.1.12. cp210x_setmaxpower description: sets the max power field of the configur ation descriptor of a cp210x device. supported devices: cp2101, cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_setmaxpower( handle handle, byte maxpower ) parameters: 1. handle?handle to the device to close as returned by cp210x_open() . 2. maxpower?1-byte value representing the maxi mum power consumption of the cp210x usb device, expressed in 2 ma units. return value: cp210x_status = cp210x_success, ? cp210x_invalid_handle, ? cp210x_device_io_failed 6.1.13. cp210x_setflushbufferconfig description: sets the flush buffer config uration of a cp210x device. supported devices: cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_setmaxpower( handle handle, ? byte flushbufferconfig ) parameters: 1. handle?handle to the device to close as returned by cp210x_open() . 2. flushbufferconfig?set to determine which buffer(s) to flush (tx and/or rx) and upon which event (open and/or close). see the header file for the bit defintions for this byte value.
AN721 rev. 1.2 31 return value: cp210x_status = cp210x_success, ? cp210x_invalid_handle, ? cp210x_function_not_supported ? cp210x_device_not_found 6.1.14. cp210x_setdevicemode description: sets the operating mode (gpio or modem) or each interface of a cp210x device. supported devices: cp2105 location: cp210x manufacturing dll prototype: cp210x_status cp210x_setmaxpower( handle handle, ? byte devicemodeeci, byte devicemodesci) parameters: 1. handle?handle to the device to close as returned by cp210x_open() . 2. devicemodeeci?set to 0 for modem mode for e nhanced interface. set to 1 for gpio mode. 3. devicemodesci?set to 0 for modem mode for e nhanced interface. set to 1 for gpio mode. return value: cp210x_status = cp210x_success, ? cp210x_invalid_handle, ? cp210x_device_not_found ? cp210x_function_not_supported 6.1.15. cp210x_setdeviceversion description: sets the device release version field of the device descriptor of a cp210x device. supported devices: cp2101, cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_setdeviceversion( handle handle, word version ) parameters: 1. handle?handle to the device to close as returned by cp210x_open() . 2. version?2-byte device release version number in binary-coded decimal (bcd) format with the upper two nibbles containing the two decimal digits of the major version and the lower two nibbles containing the two decimal digits of the minor version. return value: cp210x_status = cp210x_success, ? cp210x_invalid_handle, ? cp210x_device_io_failed 6.1.16. cp210x_setbaudrateconfig description: sets the baud rate configurat ion data of a cp210x device. supported devices: cp2102, cp2103 location: cp210x manufacturing dll prototype: cp210x_status winapi cp210x_setbaudrateconfig(handle cyhandle, baud_con- fig* baudconfigdata); parameters: 1. handle?handle to the device from which to get the part number.
AN721 32 rev. 1.2 2. baudconfigdata?pointer to a baud_config structure containing the baud config data to be set on the device. return value: cp210x_status = cp210x_success, ? cp210x_invalid_parameter, ? cp210x_invalid_handle, ? cp210x_device_io_failed 6.1.17. cp210x_setlockvalue description: sets the 1-byte lock value of a cp210x device. supported devices: cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status winapi cp210x_setlockvalue(handle cyhandle); parameters: 1. handle?handle of the device to lock. this will permanently set the lock value to 0x01. ? ? warning: setting the lock value locks all customizable data and cannot be reset; only use this function to keep all customizable data on the part permanently. return value: cp210x_status = cp210x_success, ? cp210x_invalid_parameter, ? cp210x_invalid_handle, ? cp210x_device_io_failed 6.1.18. cp210xsetportconfig description: sets the current port pin configuration from the cp210x device. supported devices: cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_setportconfig(handle handle, lpvoid portconfig) parameters: 1. handle?handle to the device as returned by cp210x_open() 2. portconfig?pointer to a port_config structure return value: cp210x_status = cp210x_success, ? cp210x_invalid_handle, ? cp210x_device_io_failed, ? cp210x_unsupported_device
AN721 rev. 1.2 33 6.1.19. cp210xsetdualportconfig description: sets the current port pin configuration from th e cp210x device. setdevicemode() must be called before calling this function. supported devices: cp2105 location: cp210x manufacturing dll prototype: cp210x_status cp210x_setportconfig(handle handle, lpvoid dualportcon- fig) parameters: 1. handle?handle to the device as returned by cp210x_open() 2. dualportconfig?pointer to a dual_port_config structure return value: cp210x_status = cp210x_success, ? cp210x_invalid_handle, ? cp210x_device_io_failed, ? cp210x_unsupported_device 6.1.20. cp210x_getdeviceproductstring description: returns the product description string of the string descriptor of a cp210x device. if the convert - toascii parameter is set, the string will be converted to ascii format before being returned to the caller. the character size limit (in characters, not bytes), not including a null terminator, is cp210x_max_product_strlen . supported devices: cp2101, cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_getdeviceproductstring( handle handle, ? lpvoid product, lpbyte length, bool converttoascii=true ) parameters: 1. handle?handle to the device to clos e as returned by cp210x_open(). 2. product?pointer to a buffer returning the product string value. 3. length?pointer to a byte value returning the length of the string in characters (not bytes), not including a null terminator. 4. converttoascii?boolean flag that tells the function whether the string needs to be converted to ascii before it is returned to the caller. the fl ag is set to true by default (i.e., the caller is expecting the string in ascii format). return value: cp210x_status = cp210x_success, ? cp210x_invalid_parameter, ? cp210x_invalid_handle, ? cp210x_device_io_failed 6.1.21. cp210xsetquadportconfig description: sets the current port pin configuration from the cp2108 device. supported devices: cp2108 location: cp210x manufacturing dll
AN721 34 rev. 1.2 prototype: cp210x_status cp210x_setquadportconfig( handle handle, lpvoid quadport- config ) parameters: 1. handle?handle to the device to clos e as returned by cp210x_open(). 2. quadportconfig?pointer to a quad_port_config structure. return value: cp210x_status = cp210x_success, ? cp210x_invalid_handle, ? cp210x_device_io_failed, ? cp210x_unsupported_device 6.1.22. cp210x_getdeviceinterfacestring description: gets the specified interface string from a cp210x device. if the converttoascii parameter is set, the string will be converted to ascii format before being re turned to the caller. the character size limit (in characters, no t bytes), not including a null terminator, is cp210x_max_serial_str - len . supported devices: cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_getdeviceinterfacestring( handle handle, ? byte interfacenumber, lpvoid interface, byte length, bool converttoas- cii) parameters: 1. handle?handle to the device to close as returned by cp210x_open() . 2. interfacenumber ?set to 0 for enhanced interface. set to 1 for standard interface. 3. interface?pointer to buffer returning the selected interface string value. 4. length?pointer to a byte value returning the length of the string in characters (not bytes), not including a null terminator. 5. converttoascii?boolean flag that tells the function whether the string needs to be converted to ascii before it is returned to the caller. the fl ag is set to true by default (i.e., the caller is expecting the string in ascii format). return value: cp210x_status = cp210x_success, ? cp210x_invalid_parameter, ? cp210x_invalid_handle, ? cp210x_device_io_failed 6.1.23. cp210x_getdeviceserialnumber description: gets the serial number string of the string desc riptor of a cp210x device. if the converttoascii parameter is set, the stri ng will be converted to ascii format before bein g returned to the caller. the character size limit (in characters, not bytes), not including a null terminator, is cp210x_ - max_serial_strlen . supported devices: cp2101, cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_getdeviceserialnumber( handle handle, ? lpvoid serialnumber, lpbyte length, bool converttoascii=true )
AN721 rev. 1.2 35 parameters: 1. handle?handle to the device to close as returned by cp210x_open() . 2. serialnumber ?pointer to a buffer returning the serial number string value. 3. length?pointer to a byte value returning the length of the string in characters (not bytes), not including a null terminator. 4. converttoascii?boolean flag that tells the function whether the string needs to be converted to ascii before it is returned to the caller. the fl ag is set to true by default (i.e., the caller is expecting the string in ascii format). return value: cp210x_status = cp210x_success, ? cp210x_invalid_parameter, ? cp210x_invalid_handle, ? cp210x_device_io_failed 6.1.24. cp210x_getdevicevid description: returns the 2-byte vendor id field of th e device descriptor of a cp210x device. supported devices: cp2101, cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_getdevicevid( handle handle, lpword vid ) parameters: 1. handle?handle to the device to close as returned by cp210x_open() . 2. vid?pointer to a 2-byte value that retu rns the vendor id of the cp210x device. return value: cp210x_status = cp210x_success, ? cp210x_invalid_parameter, ? cp210x_invalid_handle, ? cp210x_device_io_failed 6.1.25. cp210x_getdevicepid description: returns the 2-byte product id field of the device descriptor of a cp210x device. supported devices: cp2101, cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_getdevicepid( handle handle, lpword pid ) parameters: 1. handle?handle to the device to close as returned by cp210x_open() . 2. pid?pointer to a 2-byte value that retu rns the product id of the cp210x device. return value: cp210x_status = cp210x_success, ? cp210x_invalid_parameter, ? cp210x_invalid_handle, ? cp210x_device_io_failed
AN721 36 rev. 1.2 6.1.26. cp210x_getselfpower description: returns the state of the self-powered bit of the po wer attributes field of the configuration descrip - tor of a cp210x device. supported devices: cp2101, cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_getselfpower( handle handle, lpbool selfpower ) parameters: 1. handle?handle to the device to close as returned by cp210x_open() . 2. selfpower?pointer to a boolean flag where true means the self-powered bit is set, and false means the self-powered bit is cleared. return value: cp210x_status = cp210x_success, ? cp210x_invalid_parameter, ? cp210x_invalid_handle, ? cp210x_device_io_failed 6.1.27. cp210x_getmaxpower description: returns the 1-byte max power field of the configuration descriptor of a cp210x device. supported devices: cp2101, cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_getmaxpower( handle handle, lpbyte maxpower ) parameters: 1. handle?handle to the device to close as returned by cp210x_open() . 2. maxpower?pointer to a 1-byte value return ing the maximum power consumption of the cp210x usb device expressed in 2 ma units. return value: cp210x_status = cp210x_success, ? cp210x_invalid_parameter, ? cp210x_invalid_handle, ? cp210x_device_io_failed 6.1.28. cp210x_getmaxpower description: returns the 1-byte max power field of the configuration descriptor of a cp210x device. supported devices: cp2101, cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_getmaxpower( handle handle, lpbyte maxpower ) parameters: 1. handle?handle to the device to close as returned by cp210x_open() . 2. maxpower?pointer to a 1-byte value return ing the maximum power consumption of the cp210x usb device expressed in 2 ma units. return value: cp210x_status = cp210x_success, ? cp210x_invalid_parameter, ?
AN721 rev. 1.2 37 cp210x_invalid_handle, ? cp210x_device_io_failed 6.1.29. cp210x_getflushbufferconfig description: returns the flush buffer configuration of a cp210x device. supported devices: cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_getflushbufferconfig( handle handle, ? lpword flushbufferconfig ) parameters: 1. handle?handle to the device to close as returned by cp210x_open() . 2. flushbufferconfig?pointer to t he values which indicates which buffer(s) are flushed (tx and/ or rx) and upon which event (open and/or close). see the header file for the bit defintions for this byte value. return value: cp210x_status = cp210x_success, ? cp210x_device_not_found, ? cp210x_invalid_handle, ? cp210x_function_not_supported 6.1.30. cp210x_getdevicemode description: gets the operating mode (gpio or modem) or each interface of a cp210x device. supported devices: cp2105 location: cp210x manufacturing dll prototype: cp210x_status cp210x_setmaxpower( handle handle, ? byte devicemodeeci, byte devicemodesci) parameters: 1. handle?handle to the device to close as returned by cp210x_open() . 2. devicemodeeci?pointer to a 1-byte value returning the 0 if interface is in modem mode, or 1 if gpio mode. 3. devicemodesci?pointer to a 1-byte value returning the 0 if interface is in modem mode, or 1 if gpio mode. return value: cp210x_status = cp210x_success, ? cp210x_invalid_handle, ? cp210x_device_not_found ? cp210x_function_not_supported 6.1.31. cp210x_getbaudrateconfig description: returns the baud rate configuration data of a cp210x device. supported devices: cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll
AN721 38 rev. 1.2 prototype: cp210x_status winapi cp210x_getbaudrateconfig(handle cyhandle, baud_con- fig* baudconfigdata); parameters: 1. handle?handle to the device on which to determine the lock value. 2. baudconfigdata?pointer to a baud_config structure returning the baud config data of the device. return value: cp210x_status = cp210x_success, ? cp210x_invalid_parameter, ? cp210x_invalid_handle, ? cp210x_device_io_failed 6.1.32. cp210x_getlockvalue description: returns the 1-byte lock value of a cp210x device. supported devices: cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status winapi cp210x_getlockvalue(handle cyhandle, ? lpbyte lpblockvalue); parameters: 1. handle?handle to the device on which to determine the lock value. 2. lockvalue?pointer to a 1-byte value returning the lock value of the device. a 0x01 denotes that the device is locked, and a 0x00 denotes that the device is unlocked. return value: cp210x_status = cp210x_success, ? cp210x_invalid_parameter, ? cp210x_invalid_handle, ? cp210x_device_io_failed 6.1.33. cp210x_getportconfig description: gets the current port pin configuration from the cp210x device. supported devices: cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_getportconfig(handle handle, lpvoid portconfig) parameters: 1. handle?handle to the device as returned by cp210x_open() 2. port config?pointer to a port_config structure return value: cp210x_status = cp210x_success, ? cp210x_invalid_handle, ? cp210x_device_io_failed, ? cp210x_unsupported_device
AN721 rev. 1.2 39 6.1.34. cp210xgetdualportconfig description: gets the current port pin configuration from the cp210x device. supported devices: cp2105 location: cp210x manufacturing dll prototype: cp210x_status cp210x_setportconfig(handle handle, lpvoid dualportcon- fig) parameters: 1. handle?handle to the device as returned by cp210x_open() 2. dualportconfig?pointer to a dual_port_config structure return value: cp210x_status = cp210x_success, ? cp210x_invalid_handle, ? cp210x_device_io_failed, ? cp210x_unsupported_device 6.1.35. cp210x_reset description: initiates a reset of the usb interface. note: there is a delay of ~1 second before the reset is initiated by the device firmware to give the application time to call cp210x_close() to close the device handle. no further operations should be perform ed with the device until it resets, re- enumerates in windows, and a new handle is opened. supported devices: cp2101, cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x manufacturing dll prototype: cp210x_status cp210x_reset( handle handle ) parameters: 1. handle?handle to the device to close as returned by cp210x_open() . return value: cp210x_status = cp210x_success, ? cp210x_invalid_handle, ? cp210x_device_io_failed 6.1.36. cp210xgetquadportconfig description: gets the current port pin configuration from the cp210x device. supported devices: cp2105 location: cp210x manufacturing dll prototype: cp210x_status cp210x_setportconfig(handle handle, lpvoid dualportcon- fig) parameters: 1. handle?handle to the device as returned by cp210x_open() 2. dualportconfig?pointer to a dual_port_config structure return value: cp210x_status = cp210x_success, ? cp210x_invalid_handle, ? cp210x_device_io_failed, ? cp210x_unsupported_device
AN721 40 rev. 1.2 6.1.37. cp210x manufacturing.dll type definitions and constants type definitions from c++ header file cp210xmanufacturingdll.h // getproductstring() function flags #define cp210x_return_serial_number 0x00 #define cp210x_return_description 0x01 #define cp210x_return_full_path 0x02 // getdeviceversion() return codes #define cp210x_cp2101_version 0x01 #define cp210x_cp2102_version 0x02 #define cp210x_cp2103_version 0x03 #define cp210x_cp2104_version 0x04 #define cp210x_cp2105_version 0x05 #define cp210x_cp2108_version 0x06 // return codes #define cp210x_success 0x00 #define cp210x_device_not_found 0xff #define cp210x_invalid_handle 0x01 #define cp210x_invalid_parameter 0x02 #define cp210x_device_io_failed 0x03 #define cp210x_function_not_supported 0x04 #define cp210x_global_data_error 0x05 #define cp210x_file_error 0x06 #define cp210x_command_failed 0x08 #define cp210x_invalid_access_type 0x09 // type definitions typedef int cp210x_status; // buffer size limits #define cp210x_max_device_strlen 256 #define cp210x_max_product_strlen 126 #define cp210x_max_serial_strlen 63 #define cp210x_max_maxpower 250 // type definitions typedef char cp210x_device_string[cp210x_max_device_strlen]; typedef char cp210x_product_string[cp210x_max_product_strlen]; typedef char cp210x_serial_string[cp210x_max_serial_strlen]; //baud rate aliasing definitions #define num_baud_configs 32
AN721 rev. 1.2 41 typedef struct { word baudgen; word timer0reload; byte prescaler; dword baudrate; } baud_config; #define baud_config_size10 typedef baud_config baud_config_data[num_baud_configs]; //port config definitions typedef struct { word mode; // push-pull = 1, open-drain = 0 word reset_latch; // logic high = 1, logic low = 0 word suspend_latch;// logic high = 1, logic low = 0 unsigned char enhancedfxn; } port_config; // define bit locations for mode/latch for reset and suspend structures #define port_ri_on 0x0001 #define port_dcd_on 0x0002 #define port_dtr_on 0x0004 #define port_dsr_on 0x0008 #define port_txd_on 0x0010 #define port_rxd_on 0x0020 #define port_rts_on 0x0040 #define port_cts_on 0x0080 #define port_gpio_0_on 0x0100 #define port_gpio_1_on 0x0200 #define port_gpio_2_on 0x0400 #define port_gpio_3_on 0x0800 #define port_suspend_on 0x4000 // can't configure latch value #define port_suspend_bar_on 0x8000 // can't configure latch value // define bit locations for enhancedfxn #define ef_gpio_0_txled 0x01 // under device control #define ef_gpio_1_rxled 0x02 // under device control #define ef_gpio_2_rs485 0x04 // under device control #define ef_reserved_0 0x08 // reserved, leave bit 3 cleared #define ef_weakpullup 0x10 // weak pull-up on #define ef_reserved_1 0x20 // reserved, leave bit 5 cleared #define ef_serial_dynamic_suspend 0x40 // for 8 uart/modem signals #define ef_gpio_dynamic_suspend 0x80 // for 4 gpio signals
AN721 42 rev. 1.2 6.2. cp210xruntime.dll the cp210x runtime api provides access to the gpio port latch, and is meant for distribution with the product containing a cp210x device. ? cp210xrt_readlatch() ?returns the gpio port la tch of a cp210x device. ? cp210xrt_writelatch() ?sets the gpio port latch of a cp210x device. ? cp210xrt_getpartnumber() ?returns the 1-byte part nu mber of a cp210x device. ? cp210xrt_getproductstring () ?returns the product string programmed to the device. ? cp210xrt_getdeviceserialnumber () ?returns the serial number programmed to the device. ? cp210xrt_getdeviceinterfacestring () ?returns the interface string programmed to the device. typically, the user initiates communication with the target cp210x device by opening a handle to a com port using createfile() (see an197: serial communication guide for cp210x). the handle returned allows the user to call the api functions listed above. each of these functions are described in the following sections. type definitions and constants are defined in the file cp210xruntimedll.h. note: functions calls into this api are blocked until completed. this can take several milliseconds depending on usb traffic. 6.2.1. cp210xrt_readlatch description: gets the current port latch value from the device. supported devices: cp2103, cp2104, cp2105, cp2108 location: cp210x runtime dll prototype: cp210x_status cp210xrt_readlatch(handle handle, lpbyte latch) parameters: 1. handle?handle to the com port returned by createfile() . 2. latch?pointer for 1-by te return gpio latc h value [logic high = 1, logic low = 0]. return value: cp210x_status = cp210x_success, ? cp210x_invalid_handle, ? cp210x_device_io_failed ? cp210x_function_not_supported 6.2.2. cp210xrt_writelatch description: sets the current port la tch value for the device. supported devices: cp2103, cp2104, cp2105, cp2108 location: cp210x runtime dll prototype: cp210x_status cp210xrt_writelatch(handle handle, byte mask, byte latch) parameters: 1. handle?handle to the com port returned by createfile() . 2. mask?determines which pins to change [change = 1, leave = 0]. 3. latch?1-byte value to wr ite to gpio latch [logic high = 1, logic low = 0] return value: cp210x_status = cp210x_success, ? cp210x_invalid_handle, ? cp210x_device_io_failed ? cp210x_function_not_supported
AN721 rev. 1.2 43 6.2.3. cp210xrt_getpartnumber description: gets the part number of the current device. supported devices: cp2101, cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x runtime dll prototype: cp210x_status cp210xrt_getpartnumber(handle handle, lpbyte partnum) parameters: 1. handle?handle to the com port returned by createfile() . 2. partnum?pointer to a byte containing the return code for the part number. return value: cp210x_status = cp210x_success, ? cp210x_invalid_handle, ? cp210x_device_io_failed 6.2.4. cp210xrt_getdeviceproductstring description: gets the product string in the current device. supported devices: cp2101, cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x runtime dll prototype: cp210x_status cp210xrt_getdeviceproductstring(handle cyhandle, ? lpvoid lpproduct, lpbyte lpblength, bool bconverttoascii = true) parameters: 1. handle?handle to the com port returned by createfile() . 2. lpproduct?variable of type cp210x_produc t_string returning the null terminated product string. 3. lpblength?length in characters (not bytes) not including a null terminator. 4. converttoascii?boolean that determines whethe r the string should be left in unicode, or converted to asci i. this parameter is true by default, and will convert to ascii. return value: cp210x_status = cp210x_success, ? cp210x_invalid_handle, ? cp210x_device_io_failed ? cp210x_invalid_parameter 6.2.5. cp210xrt_getdeviceserialnumber description: gets the serial number in the current device. supported devices: cp2101, cp2102, cp2103, cp2104, cp2105, cp2108 location: cp210x runtime dll prototype: cp210x_status cp210xrt_getdeviceserialnumber(handle cyhandle, ? lpvoid lpproduct, lpbyte lpblength, bool bconverttoascii = true) parameters: 1. handle?handle to the com port returned by createfile() . 2. lpproduct?variable of type cp210x_serial_s tring returning the null terminated serial string. 3. lpblength?length in characters (not bytes) not including a null terminator.
AN721 44 rev. 1.2 4. converttoascii?boolean that determines whethe r the string should be left in unicode, or converted to asci i. this parameter is true by default, and will convert to ascii. return value: cp210x_status = cp210x_success, ? cp210x_invalid_handle, ? cp210x_device_io_failed ? cp210x_invalid_parameter 6.2.6. cp210xrt_getdeviceinterfacestring description: gets the interface string of the current device. supported devices: cp2105, cp2108 location: cp210x runtime dll prototype: cp210x_status cp210xrt_getdeviceinterfacestring(handle cyhandle, ? lpvoid lpinterfacestring, lpbyte lpblength, bool bconverttoascii = true) parameters: 1. handle?handle to the com port returned by createfile() . 2. lpinterfacestring?variable of type cp210x_s erial_string returning the null terminated interface string. 3. lpblength?length in characters (not bytes) not including a null terminator. 4. converttoascii?boolean that determines whethe r the string should be left in unicode, or converted to asci i. this parameter is true by default, and will convert to ascii. return value: cp210x_status = cp210x_success, ? cp210x_invalid_handle, ? cp210x_device_io_failed ? cp210x_invalid_parameter
AN721 rev. 1.2 45 c ontact i nformation silicon laboratories inc. 400 west cesar chavez ? austin, tx 78701 ? tel: 1+(512) 416-8500 ? fax: 1+(512) 416-9669 ? toll free: 1+(877) 444-3032 please visit the silicon labs technical support web page: ? https://www.silabs.com/support/pages/contacttechnicalsupport.aspx ? and register to submit a technical support request. patent notice silicon labs invests in research and development to help our cust omers differentiate in the market with innovative low-power, s mall size, analog- intensive mixed-signal soluti ons. silicon labs' extensive pat ent portfolio is a testament to our unique approach and world-clas s engineering team. silicon laboratories and silicon labs are trademarks of silicon laboratories inc. other products or brandnames mentioned herein are trademarks or registered trademarks of their respective holders. the information in this document is believed to be accurate in all respects at the time of publ ication but is subject to change without notice. silicon laboratories assumes no responsibili ty for errors and omissions, and disclaim s responsibility for any consequences resu lting from the use of information included herein. a dditionally, silicon laboratorie s assumes no responsibility for the functioning of und escribed fea- tures or parameters. silicon laboratories reserves the right to make changes without further notice. silicon laboratories makes no warran- ty, representation or guarantee regarding t he suitability of its products for any par ticular purpose, nor does silicon laborato ries assume any liability arising out of the application or use of any product or circuit, and specif ically disclaims any and all liability, in cluding without limitation consequential or incidental damages . silicon laboratories products are not designed, intended, or authorized for use in applica tions intend- ed to support or sustain life, or for any other application in which the failure of the silicon laboratories product could crea te a situation where personal injury or death may occur. should buyer purchase or us e silicon laboratories products for any such unintended or unaut horized application, buyer shall indemnify and hold silicon laboratories harmle ss against all claims and damages.


▲Up To Search▲   

 
Price & Availability of AN721

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X